package xkp.lesson4;

import org.junit.Test;

public class StringAPITest {
	
	@Test
	public void test1() {
		String str = "abcdefg123e56";
		int length = str.length();
		System.out.println(length);
		System.out.println(str.charAt(5));
		System.out.println(str.indexOf('e'));
		System.out.println(str.indexOf('e',5));
		System.out.println(str.indexOf("123"));
		System.out.println(str.substring(4));
		System.out.println(str.substring(4,6));
		String musicName = "abc.mp3";
		System.out.println(musicName.endsWith(".mp3"));
		String str2 = "abc";
		String str3 = new String("abc");
		System.out.println(str2.equals(str3));
		String str4 = "AbC";
		System.out.println(str2.equalsIgnoreCase(str4));
		char[] arrChar = {'1','a','c'};
		String str5 = String.copyValueOf(arrChar);
		//指向常量区"123100"
		String str6 = "123"+100;
		String str7 = "   sfdsf sdjfsd    ";
		System.out.println(str7.trim());
		
		String str8 = "abcdasdasdsa";
		String str9 = "aecd";
		System.out.println(str8.compareTo(str9));
		
	}

}
